package erp.education.server.db.implementation.setup.school;

 

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import erp.education.server.db.entites.setup.school.Courses;
import erp.education.server.db.entites.setup.school.Schools;
import erp.education.server.db.implementation.common.BaseDAO;
import erp.education.server.db.interfaces.setup.school.CoursesDAOI;
@Component("coursesDao")
public class CoursesDAO extends BaseDAO implements CoursesDAOI {

	@Override
	public Courses getCourse(String courseName) {
		// TODO Auto-generated method stub
		Courses course=null;
		Map params=new HashMap();
		params.put("courseName", courseName);
		
		
		course=(Courses)getSingleResult("select course from Courses course where course.courseName=:courseName ", params);
	 
		 
		 
		return course;
	}
	@Override
	public List<Courses> getCourses() {
		// TODO Auto-generated method stub
		List<Courses> courses=null;
		Map params=new HashMap();
		courses=(List<Courses>) getResultList("select course from Courses course  ", params);
			return courses;
	}
	
	@Override
	public Courses getCourse(Long courseId) {
		// TODO Auto-generated method stub
		Courses course=null;
		Map params=new HashMap();
		params.put("courseId", courseId);
		
		
		course=(Courses)getSingleResult("select course from Courses course where course.courseId=:courseId ", params);
	 
		 
		 
		return course;
	}
}
